/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package as24gc.csv;

import as24gc.common.Utility;
import as24gc.db.Vehicles;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author nico.vassallo
 */
public class CsvLine {

    private String index_001 = ";";
    private String index_002 = ";";//vid Car Number
    private String index_003 = ";";
    private String index_004 = ";";
    private String index_005 = ";";
    private String index_006 = ";";
    private String index_007 = ";";
    private String index_008 = ";";
    private String index_009 = ";";
    private String index_010 = ";";
    private String index_011 = ";";
    private String index_012 = ";";//valuta
    private String index_013 = ";";
    private String index_014 = ";";
    private String index_015 = ";";
    private String index_016 = ";";
    private String index_017 = ";";
    private String index_018 = ";";
    private String index_019 = ";";
    private String index_020 = ";";
    private String index_021 = ";";
    private String index_022 = ";";
    private String index_023 = ";";
    private String index_024 = ";";
    private String index_025 = ";";
    private String index_026 = ";";
    private String index_027 = ";";
    private String index_028 = ";";
    private String index_029 = ";";
    private String index_030 = ";";
    private String index_031 = ";";
    private String index_032 = ";";
    private String index_033 = ";";
    private String index_034 = ";";
    private String index_035 = ";";
    private String index_036 = ";";
    private String index_037 = ";";
    private String index_038 = ";";
    private String index_039 = ";";
    private String index_040 = ";";
    private String index_041 = ";";
    private String index_042 = ";";
    private String index_043 = ";";
    private String index_044 = ";";
    private String index_045 = ";";
    private String index_046 = ";";
    private String index_047 = ";";
    private String index_048 = ";";
    private String index_049 = ";";
    private String index_050 = ";";
    private String index_051 = ";";
    private String index_052 = ";";
    private String index_053 = ";";
    private String index_054 = ";";
    private String index_055 = ";";
    private String index_056 = ";";
    private String index_057 = ";";
    private String index_058 = ";";
    private String index_059 = ";";
    private String index_060 = ";";
    private String index_061 = ";";
    private String index_062 = ";";
    private String index_063 = ";";
    private String index_064 = ";";
    private String index_065 = ";";
    private String index_066 = ";";
    private String index_067 = ";";
    private String index_068 = ";";
    private String index_069 = ";";
    private String index_070 = ";";
    private String index_071 = ";";
    private String index_072 = ";";
    private String index_073 = ";";
    private String index_074 = ";";
    private String index_075 = ";";
    private String index_076 = ";";
    private String index_077 = ";";
    private String index_078 = ";";
    private String index_079 = ";";
    private String index_080 = ";";
    private String index_081 = ";";
    private String index_082 = ";";
    private String index_083 = ";";
    private String index_084 = ";";
    private String index_085 = ";";
    private String index_086 = ";";
    private String index_087 = ";";
    private String index_088 = ";";
    private String index_089 = ";";
    private String index_090 = ";";
    private String index_091 = ";";
    private String index_092 = ";";
    private String index_093 = ";";
    private String index_094 = ";";
    private String index_095 = ";";
    private String index_096 = ";";
    private String index_097 = ";";
    private String index_098 = ";";
    private String index_099 = ";";
    private String index_100 = ";";
    private String index_101 = ";";
    private String index_102 = ";";
    private String index_103 = ";";
    private String index_104 = ";";
    private String index_105 = ";";
    private String index_106 = ";";
    private String index_107 = ";";
    private String index_108 = ";";
    private String index_109 = ";";
    private String index_110 = ";";
    private String index_111 = ";";
    private String index_112 = ";";
    private String index_113 = ";";
    private String index_114 = ";";

    private String getDateFormat(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("MM");
        String dateStringFormat = sdf.format(date);
        sdf.applyPattern("yyyy");
        dateStringFormat += "." + sdf.format(date);
        return dateStringFormat;
    }

    public void setVehicleToLine(Vehicles v) {

        this.index_001 = "" + v.getDealers().getId() + ";";

        this.index_003 = Utility.getImageFileName(v.getMedia().split(";")[0]) + ";";
        this.index_004 = v.getBrand() + ";";
        this.index_005 = v.getModel() + ";";
        this.index_006 = v.getVersion() + ";";
        this.index_007 = v.getCategory() + ";";
        this.index_008 = v.getGearType() + ";";
        this.index_009 = v.getBody() + ";";
        
        this.index_010 = v.getBodyColor() + ";";
        this.index_092 = v.getBodyColor() + ";";
        
        this.index_011 = v.getBodyPainting() + ";";

        this.index_013 = v.getFuelType() + ";";



        this.index_014 = getDateFormat(v.getInitialRegistration()) + ";";
        this.index_015 = "" + v.getMileage() + ";";
        this.index_016 = v.getPrices() + ";";

        this.index_020 = "" + v.getKilowatt() + ";";
        if (v.getNote() != null) {
            System.out.println("v.getNote() != null");
            this.index_059 = "" + v.getNote() + ";";
        }

    }

    public String getLine() {
        return index_001 + index_002 + index_003 + index_004 + index_005 + index_006 + index_007 + index_008 + index_009 + index_010 + index_011 + index_012 + index_013 + index_014 + index_015 + index_016 + index_017 + index_018 + index_019 + index_020 + index_021 + index_022 + index_023 + index_024 + index_025 + index_026 + index_027 + index_028 + index_029 + index_030 + index_031 + index_032 + index_033 + index_034 + index_035 + index_036 + index_037 + index_038 + index_039 + index_040 + index_041 + index_042 + index_043 + index_044 + index_045 + index_046 + index_047 + index_048 + index_049 + index_050 + index_051 + index_052 + index_053 + index_054 + index_055 + index_056 + index_057 + index_058 + index_059 + index_060 + index_061 + index_062 + index_063 + index_064 + index_065 + index_066 + index_067 + index_068 + index_069 + index_070 + index_071 + index_072 + index_073 + index_074 + index_075 + index_076 + index_077 + index_078 + index_079 + index_080 + index_081 + index_082 + index_083 + index_084 + index_085 + index_086 + index_087 + index_088 + index_089 + index_090 + index_091 + index_092 + index_093 + index_094 + index_095 + index_096 + index_097 + index_098 + index_099 + index_100 + index_101 + index_102 + index_103 + index_104 + index_105 + index_106 + index_107 + index_108 + index_109 + index_110 + index_111 + index_112 + index_113 + index_114;
    }
}
